<%@ Page language="c#" Codebehind="Properties.aspx.cs" AutoEventWireup="false" Inherits="AMFC.Manager.Underwriting.Properties" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns:amfc>
<head>
<title>Brokers</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<?IMPORT namespace="amfc" implementation="/include/htc/datagrid.htc">
<script src="/include/common.js"></script>
<script src="/include/soap.js"></script>
<script src="/include/XML.js"></script>
</head>
<body style="background-color:menu;" bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0" scroll="yes" onload="window.focus()">
<amfc:htcDatagrid id="dtg" caption="Properties"
			allowEdit="true" allowAdd="true" allowDelete="true" allowFilter="false"
			style="width:1%;overflow-x:visible"
			hiddenFields="id"
			onDelete="deleteRecord('Property_Delete')"
			onEdit="editRecord('Property_Update')"
			onAdd="addRecord('Property_Add')"
>
		<SELECTS id="HMDATypeID ">
			<ASP:LITERAL ID="ltrHMDAProps" Runat="server"></ASP:LITERAL>
		</SELECTS>
		<SELECTS id="PropertyCategoryID ">
			<ASP:LITERAL ID="ltrCategories" Runat="server"></ASP:LITERAL>
		</SELECTS>
		<SELECTS id="PropertyTypeTypeID ">
			<ASP:LITERAL ID="ltrPropertyTypeTypeID" Runat="server"></ASP:LITERAL>
		</SELECTS>
		<RS>
			<asp:Literal ID="ltrProps" Runat="server"></asp:Literal>
		</RS>
</amfc:htcDatagrid>
</body>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</html>
<script>
initWS("Administration","Administration.asmx");
function deleteRecord(webMethod){
	var rs = event.rs;
	if( !checkWS() || !confirm("Delete "+rs("Name")+"?") )event.returnValue = false;
	var ret = WS(CO(webMethod),_getID());
	if(showSOAPError(ret)) return event.returnValue = false;
}
function editRecord(webMethod){
	if(!checkWS()) event.returnValue = false;
	var ret = WS(CO(webMethod),_getID(),event.fieldName,event.fieldValue);
	if(showSOAPError(ret)) return event.returnValue = false;
}
function addRecord(webMethod){
	if(!checkWS()) return event.returnValue = false;
	var rs = event.rs;
	var ret = WS(CO("Property_Add"),getDSFromRS(rs,"xmlAdd"));
	if( showSOAPError(ret) )return event.returnValue = false;
	_getID(ret.value);
}
// ***** Contacts *****
function showContacts(brokerID){
	if(!checkWS(true)) return setTimeout("showContacts("+(brokerID||_getID())+")",1000);
	WS(function(ret){cb(ret,_brokerName())},"BrokerContacts",brokerID||_getID());
	// Local
	function cb(ret,brokerName){
		if( showSOAPError(ret) )return;
		dtgBrokerContacts.caption = "Contacts for "+brokerName;
		dtgBrokerContacts.recordset = ret.value;
	}
}
function addContact(){
	if(!checkWS()) return event.returnValue = false;
	var rs = event.rs;
	var ret = WS(CO("Contact_Add"),_brokerID(),getDSFromRS(rs));
	if( showSOAPError(ret) )return event.returnValue = false;
	showContacts(_brokerID());
}
// **** Properties *****
function _getID(id){
	if( arguments.length > 0 )event.rs("ID").value = id;
	return event.rs("ID").value;
}
function _brokerID(){ return dtg.recordset.Fields("ID").Value } 
function _brokerName(){ return dtg.recordset.Fields("Name").Value } 
</script>
